<template>
<div>
  <h1>新增课程分类</h1>
  <el-row>
    <el-col :span="8"><div class="grid-content bg-purple"><p></p></div></el-col>
    <el-col :span="8"><div class="grid-content bg-purple-light">
      *分类名称：<el-input v-model="subject_name" placeholder="请输入" style="width: 100%"></el-input>
    </div></el-col>
    <el-col :span="8"><div class="grid-content bg-purple"><p></p></div></el-col>
  </el-row>
  <el-row>
  </el-row>
  <br>
  <el-row>
    <el-col :span="8"><p></p></el-col>
    <el-col :span="4"><el-button @click="myback" >取消</el-button></el-col>
    <el-col :span="4"><el-button @click="myclick" type="primary" style="float: right">确定</el-button></el-col>
    <el-col :span="8"><p></p></el-col>
  </el-row>
  <!--<p>输入的内容为(数据双向绑定)：{{subject_name}}</p>-->
</div>
</template>

<script>
    import { postnewcategory } from '@/api/course'
    export default {
      name: 'newcouserclass',
      data() {
        return {
          subject_name: ''
        }
      },
      methods: {
        myclick() {
          console.log(this.subject_name)
          postnewcategory(this.subject_name).then(response => {
            const data = response.data
            console.log(data)
            this.$router.push({ name: 'couserclassmanager' })
          }).catch(error => {
            console.log(error)
          })
        },
        myback() {
          this.$router.push({ name: 'couserclassmanager' })
        }
      }
    }
</script>

<style scoped>

</style>
